package 二分查找;

public class Solution4 {
    //https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
    public int minNumberInRotateArray (int[] nums) {
        //题解：
        int left = 0;
        int right = nums.length - 1;
        int mid = (left + right) / 2;
        while (left != right) {
            if (nums[mid] > nums[right]) {
                left = mid + 1;
            }else if (nums[mid] < nums[right]) {
                right = mid;
            }else {
                right--;
            }
            mid = (left + right) / 2;
        }
        return nums[left];
    }
}
